package com.sdgakj.study.thread.pc.lock;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Author: Du Ronghong
 * @Description:
 * @Date: Created in 18:44 2018/8/28
 * @Modified By:
 */
public class LockPCTest {
    public static void main(String[] args) {
        Lock lock = new ReentrantLock();
        Condition producerCondition = lock.newCondition();
        Condition consumerCondition = lock.newCondition();
        Data data = new Data(lock,producerCondition,consumerCondition);
        new Thread(new ProducerThread(data),"生产者A").start();
        new Thread(new ProducerThread(data),"生产者B").start();
        new Thread(new ConsumerThread(data),"消费者A").start();
    }
}
